package com.ruoyi.dataserver.controller;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.dataserver.service.IUpSteamAnalyzeService;
import com.ruoyi.dataserver.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ProjectName intelligent-city
 * @Package com.lab.dataserver.controller
 * @ClassName TopologyAnalyzeController
 * @Description 上游分析控制器
 * @Company LAB
 * @Author wangw
 * @Date 2020/7/09 11:37
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/upStreamController")
@Slf4j
public class UpStreamAnalyzeController {

    @Autowired
    private IUpSteamAnalyzeService topologyAnalyzeService;

//    @Autowired
//    private ITestUpSteamAnalyzeService testUpSteamAnalyzeService;

    /**
     * @Title  上游分析接口
     * @Description
     * @return
     * @author wangw
     * @date 2020/7/10 0010 10:57
    */
    @RequestMapping(value = "/analyze",method = RequestMethod.POST)
    public R upStreamAnalyze(@RequestBody Map map){
        if(StrUtil.isBlank(map.get("DM").toString()) || StrUtil.isBlank(map.get("USIdparm").toString())){
            return R.failed("参数为null.");
        }
        String dm = map.get("DM").toString();
        String usidParm = map.get("USIdparm").toString();
        return R.ok(topologyAnalyzeService.upStreamAnalyze(dm,usidParm));
    }

    /**
     * @Title  上游分析接口
     * @Description
     * @return
     * @author wangw
     * @date 2020/7/10 0010 10:57
     */
//    @RequestMapping(value = "/analyze1",method = RequestMethod.POST)
//    public R upStreamAnalyze1(@RequestBody Map map){
//        if(StrUtil.isBlank(map.get("DM").toString()) || StrUtil.isBlank(map.get("USIdparm").toString())){
//            return R.failed("参数为null.");
//        }
//        String dm = map.get("DM").toString();
//        String usidParm = map.get("USIdparm").toString();
//        return R.ok(testUpSteamAnalyzeService.upStreamAnalyze(dm,usidParm));
//    }
}
